E.debug = {};

var $DO = E.debug.printObject = function(args) {
    var table = "<div id='debugDiv'><table border='2'>";

    for ( var i in args) {
        table += "<tr><td>" + i + "</td><td>" + args[i] + "</td></tr>";
    }

    table += "</table></div>";

    var _win = Ext.create('Ext.window.Window', {
        title : 'debug',
        height : 400,
        width : 1000,
        layout : 'fit',
        html : table,
        modal : true,
        listeners : {
            keypress : {
                element : 'el',
                fn : function(e) {
                    if (e.getKey() == 32 || e.getKey() == 13) {
                        _win.close();
                    }
                }
            }
        }
    });

    _win.show();
}

var $DH = E.debug.printHTML = function(args) {
    var _txt = "<textarea rows='50' cols='200'>" + args + "</textarea>";

    var _win = Ext.create('Ext.window.Window', {
        title : 'debug',
        height : 400,
        width : 1000,
        layout : 'fit',
        html : _txt,
        modal : true,
        listeners : {
            keypress : {
                element : 'el',
                fn : function(e) {
                    if (e.getKey() == 32 || e.getKey() == 13) {
                        _win.close();
                    }
                }
            }
        }
    });

    _win.show();
}
